<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>报价单管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" type="text/css" href="../../common/bootstrap/css/bootstrap.css" media="all">
    <link rel="stylesheet" type="text/css" href="../../common/layui/css/layui.css" media="all">
    <link rel="stylesheet" type="text/css" href="../../common/global.css" media="all">
    <link rel="stylesheet" type="text/css" href="../../css/customer_list.css" media="all">
</head>
<style>
    #roleAuthTable + .layui-table-view .layui-table tbody tr:hover {
        background-color: transparent;
    }
    tbody tr .layui-table-cell {
        height: auto !important;
    }
    tbody tr td:last-child .layui-table-cell{
        white-space: normal !important; /* 允许多行显示 */
        word-break: break-all;          /* 长单词或 URL 地址换行 */
    }
    tbody tr td:nth-child(8) .layui-table-cell{
        white-space: normal !important; /* 允许多行显示 */
        word-break: break-all;          /* 长单词或 URL 地址换行 */
    }
</style>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <div class="layui-form toolbar layui-form-pane">
                <form lay-filter="searchStationForm" id="searchStationForm" class="layui-form model-form">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label w-auto">询价来源</label>
                            <div class="layui-input-inline">
                                <input name="bus_from_company_name" id="bus_from_company_name" class="layui-input" type="text" placeholder="" autocomplete="off"/>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label w-auto">询价单号</label>
                            <div class="layui-input-inline">
                                <input name="bus_inquiry_no" id="bus_inquiry_no" class="layui-input" type="text" placeholder="" autocomplete="off"/>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label w-auto">询价人</label>
                            <div class="layui-input-inline">
                                <input name="bus_user" class="layui-input" type="text" placeholder="" autocomplete="off"/>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">报价时间</label>
                            <div class="layui-input-inline">
                                <input type="text" name="due_date" placeholder="时间段" class="layui-input" id='due_date'>
                            </div>
                        </div>
                    </div>

                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label w-auto">车牌号</label>
                                <div class="layui-input-inline">
                                    <input name="vehicle_license_num" class="layui-input" type="text" placeholder="" autocomplete="off"/>
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label w-auto">车架号</label>
                                <div class="layui-input-inline">
                                    <input name="vehicle_frame_no" id="vehicle_frame_no" class="layui-input" type="text" placeholder="" autocomplete="off"/>
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label w-auto">车辆品牌</label>
                                <div class="layui-input-inline">
                                    <input name="brand_name" id="brand_name" class="layui-input" type="text" placeholder="" autocomplete="off"/>
                                </div>
                            </div>

                            <div class="layui-inline">
                                <label class="layui-form-label w-auto">车型</label>
                                <div class="layui-input-inline">
                                    <input name="car_model" id="car_model" class="layui-input" type="text" placeholder="" autocomplete="off"/>
                                </div>
                            </div>
                        </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label w-auto">配件商</label>
                            <div class="layui-input-inline">
                                <input name="bus_to_company_name" id="bus_to_company_name" class="layui-input" type="text" placeholder="" autocomplete="off"/>
                            </div>
                        </div>


                        <div class="layui-inline">
                            <label class="layui-form-label w-auto">修理厂</label>
                            <div class="layui-input-inline">
                                <input name="repair_company" class="layui-input" type="text" placeholder="" autocomplete="off"/>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label w-auto">业务员</label>
                            <div class="layui-input-inline">
                                <input name="add_user_name" class="layui-input" type="text" placeholder="" autocomplete="off"/>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <button id="btnSearch" class="layui-btn icon-btn"><i class="layui-icon">&#xe615;</i>搜索
                            </button>
                            <button id="btnReset" class="layui-btn layui-btn-warm"><i class="layui-icon">&#xe669;</i>重置
                            </button>
                        </div>
                    </div>
                </form>
            </div>

            <table class="layui-table" id="infoTable" lay-filter="infoTable"></table>
        </div>
    </div>
</div>
<script type="text/javascript" src="../../js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="../../js/jquery.cookie.js"></script>
<script type="text/javascript" src="../../common/layui/layui2.js"></script>
<script type="text/javascript" src="../../js/common.js"></script>
<script type="text/javascript" src="../../js/main.js"></script>
<!-- js部分 -->
<script>
    layui.use(['layer', 'form', 'table','admin', 'laydate'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var table = layui.table;
        var admin = layui.admin;
        var laydate = layui.laydate;
        var user_info =  JSON.parse(getSessionStorage('uanme'));

        laydate.render({
            elem: '#due_date'
            ,range: true
            ,trigger: 'click'
        });

        form.render();

        //渲染表格
        table.render({
            elem: '#infoTable',
            url: access_baseurl+'Quotation/getList',
            where: {
                opt_role_id:user_info.role_id,
                opt_user_id:user_info.user_id
            },
            page: true,
            limit:20,
            cellMinWidth: 100,
            cols: [[
                {field: 'bus_inquiry_no', title: '询价单号',width: 230,templet: function (d) {
                        return "<a lay-event='detail' style='border-bottom: 1px solid blue;color: blue;'>"+d.bus_inquiry_no+"</a>";
                    }},
                {field: 'bus_from_company_name', title: '询价来源'},
                {field: 'vehicle_frame_no', title: '车架号',width: 230},
                {field: 'vehicle_license_num', title: '车牌号'},
                {field: 'brand_name', title: '车辆品牌'},
                {field: 'car_model', title: '车型名称'},
                {field: 'bus_user_name', title: '询价人'},
                {field: 'add_user_name', title: '业务员'}
            ]]
        });

        // 搜索按钮点击事件
        $('#btnSearch').click(function () {
            var where = getWhere();
            table.reload('infoTable', {where: where});
            return false;
        });
        $('#btnReset').click(function () {
            var t = $('#searchStationForm [name]').serializeArray();
            var data={};
            $.each(t, function() {
                data[this.name] = '';
            });
            form.val('searchStationForm',data);
            form.render();
            table.reload('infoTable', {where: data});
            return false;
        });
        // 工具条点击事件
        table.on('tool(infoTable)', function (obj) {
            var data = obj.data;
            if (obj.event === 'detail') { //修改
                var supplier_id = data.from_quotation_selection_json.add_company_id
                var org_profit_rate = data.from_quotation_selection_json.org_profit_rate==undefined?'':data.from_quotation_selection_json.org_profit_rate
                var matching_profit_rate = data.from_quotation_selection_json.matching_profit_rate==undefined?'':data.from_quotation_selection_json.matching_profit_rate
                var complete_profit_rate = data.from_quotation_selection_json.complete_profit_rate==undefined?'':data.from_quotation_selection_json.complete_profit_rate
                var suitable_profit_rate = data.from_quotation_selection_json.suitable_profit_rate==undefined?'':data.from_quotation_selection_json.suitable_profit_rate
                window.parent.go_to_page_general('./html/quote/quotation.html','id='+data.id+'&supplier_id='+supplier_id+'&org_profit_rate='+org_profit_rate+'&matching_profit_rate='+matching_profit_rate+'&complete_profit_rate='+complete_profit_rate+'&suitable_profit_rate='+suitable_profit_rate);
            }
        });
        function getWhere() {
            var t = $('#searchStationForm [name]').serializeArray();
            var where = {};
            $.each(t, function() {
                where[this.name] = this.value;
            });
            return where;
        }
    });
</script>
</body>
</html>